module immgen (
  input  [31:0] imm_in,
  input  [2:0] immgen_op,
  output  [63:0] imm
);

reg [63:0] immi;
assign imm = immi;

always @(*) begin
    case(immgen_op)
        3'b000:   immi = 64'h0;
        3'b001:   immi = {{52{imm_in[31]}}, imm_in[31:20]};                                           //I TYPE
        3'b010:   immi = {{52{imm_in[31]}},imm_in[31:25],imm_in[11:7]};                               //S TYPE
        3'b011:   immi = {{52{imm_in[31]}},imm_in[7],imm_in[30:25],imm_in[11:8],1'b0};                //B TYPE
        3'b100:   immi = {{32{imm_in[31]}},imm_in[31:12],12'b0};                                      //U TYPE
        3'b101:   immi = {{44{imm_in[31]}},imm_in[19:12],imm_in[20],imm_in[30:21],1'b0};              //J TYPE
        3'b110:   immi = {59'b0,imm_in[24:20]};                                                       //SRA
        3'b111:   immi = {59'b0,imm_in[24:20]};                                                       //SRAW
    endcase
end

endmodule